package com.example.preventlosing;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.media.AudioManager;
import android.media.SoundPool;
import android.os.Bundle;
import android.os.SystemClock;
import android.os.Vibrator;
import android.util.Log;
import android.view.View;
import android.widget.Button;

public class SearchActivity extends Activity {

	Button gpsBtn;
	Button soundBtn;
	Button camBtn;
	String ip;
	
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_search);
		
		gpsBtn = (Button)findViewById(R.id.searchGpsButton);
		soundBtn = (Button)findViewById(R.id.serachSoundButton);
		camBtn = (Button)findViewById(R.id.searchCameraButton);
		
		Intent i = getIntent();
		ip = i.getStringExtra("ip");
		
		
	}
	
	
	public void mOnClick(View v) {
		switch (v.getId()) {
		case R.id.searchGpsButton:
			TCPClient client = new TCPClient(SearchActivity.this,ip,"gps");
			client.start();
			break;
		
		case R.id.serachSoundButton:
			TCPClient client2 = new TCPClient(SearchActivity.this,ip,"sound");
			client2.start();
			break;
		
		case R.id.searchCameraButton:
			TCPClient client3 = new TCPClient(SearchActivity.this,ip,"camera");
			client3.start();
			break;
		 
		}
		
	}
	
	public void startIntent(String lalo) {
		
		Log.e("lalo",lalo);
		Intent intent1 = new Intent(this, FragmentActivity.class);
		
		intent1.putExtra("lalo", lalo);
		startActivity(intent1);
		
		
	}
	
public void startImageIntent(byte[] imageData) {
		
		Log.e("image",imageData[1]+"");
		Intent intent1 = new Intent(this, ImageActivity.class);
		
		intent1.putExtra("imageData", imageData);
		startActivity(intent1);
		
		
	}
}
